import os

def dirsize(path="./"):
	''' 获取指定文件夹大小，无参数传入则返回当前所在目录大小 
		返回:总字节数
	'''
	size = 0
	dirlist = os.listdir(path)

	for file in dirlist:
		urlpath = os.path.join(path,file)
		if os.path.isfile(urlpath):
			size += os.path.getsize(urlpath)
		if os.path.isdir(urlpath):
			size += dirsize(urlpath)

	return size

print("-" * 50)

#size = dirsize("./hh")
#print("文件夹大小：%.2f MB (%d)字节" % (size/1024/1024,size))

size = dirsize()
print("当前目录大小：%.2f MB (%d)字节" % (size/1024/1024,size))